<?php

Raise::load('core.RaiseObject');
Raise::load('core.RaiseRegex');

/**
 * RaiseRegexMatch class
 * Represents a regular expression match
 *
 * @author Sam-Mauris Yong <hellclanner at live dot com>
 * @license http://www.opensource.org/licenses/bsd-license New BSD License
 * @package Raise.Core.Text.Regex
 * @since 1.2
 */
class RaiseRegexMatch extends RaiseObject {

    /**
     * The regular expression RaiseRegex object that this match originated from
     * @var RaiseRegex
     */
    private $regex;

    /**
     * The text that matched the pattern
     * @var string
     */
    private $match;

    /**
     * Creates a new RaiseRegexMatch
     * @param RaiseRegex $regex
     * @param string $match
     */
    public function __construct($regex, $match){
        $this->regex = $regex;
        $this->match = $match;
    }

    /**
     * Get the regular expression RaiseRegex object that this match originated from
     * @return RaiseRegex
     */
    public function regex(){
        return $this->regex;
    }

    /**
     * Get the text that matched the pattern
     * @return string
     */
    public function match(){
        return $this->match;
    }

}
